package exam.ccwtest;

import android.app.*;
import android.content.*;
import android.os.*;
import android.view.*;
import android.widget.*;

public class c06_HandlerOrder extends Activity {
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		View vw = new MyView(this);
		
		// 리스터 1순위
		vw.setOnTouchListener(new View.OnTouchListener() {
			public boolean onTouch(View v, MotionEvent event) {
				if (event.getAction() == MotionEvent.ACTION_DOWN) {
					Toast.makeText(c06_HandlerOrder.this, "리스터 우선순위 1", Toast.LENGTH_SHORT).show();
					return true;
				}	// if end				
				return false;
			}
		});
		
		setContentView(vw);		
	}	// onCreate end
	
	protected class MyView extends View {
		public MyView (Context context) {
			super(context);
		}
		
		//* 뷰의 콜백메소드 2순위
		public boolean onTouchEvent (MotionEvent event) {
			if (event.getAction() == MotionEvent.ACTION_DOWN) {
				Toast.makeText(c06_HandlerOrder.this, "콜백 메소드 2순위", Toast.LENGTH_SHORT).show();
				return true;				
			}
			return false;
		}
		
		//*/
	}	// MyView end
	
	//* 액티비티 콜백메소드 3순위
	public boolean onTouchEvent (MotionEvent event) {
		if (event.getAction() == MotionEvent.ACTION_DOWN) {
			Toast.makeText(c06_HandlerOrder.this, "액티비티 콜백 메소드 3순위", Toast.LENGTH_SHORT).show();
			return true;
		}
		return false;
	}
}
















